import { Modal, Button, Icon } from 'antd';
import React from 'react';
import PropTypes from 'prop-types';
import './index.less';
export default function CallbackModel({
  title = '标题',
  content = '内容',
  footer,
  visible,
  setVisible
}) {
  const handleCancel = () => {
    // 处理取消按钮点击事件
    setVisible(false);
  };

  const customFooter = () => {
    return (
      <div className="call-back-model-custom-footer">
        <Button onClick={handleCancel}>关闭弹框</Button>
        {footer}
      </div>
    );
  };

  return (
    <>
      <Modal
        visible={visible}
        onCancel={handleCancel}
        width={540}
        footer={null}
        closable={false}
        className="call-back-model"
      >
        <Icon type="check-circle" />
        <span className="call-back-model-title">{title}</span>
        <p className="call-back-model-content">{content}</p>
        {customFooter()}
      </Modal>
    </>
  );
}
CallbackModel.propTypes = {
  title: PropTypes.string,
  content: PropTypes.string,
  footer: PropTypes,
  visible: PropTypes,
  setVisible: PropTypes
};
